from django.http import JsonResponse
from django.shortcuts import render

# Create your views here.
from rest_framework.views import APIView

from UShop.models import Skuimage, TbNews2
from home.serializer import SkuimageSerializer
from news.serializer import NewsSerializer


class showViewSet(APIView):

    def get(self, request):
        # carousel = Skuimage.objects.order_by('ma_id')[2:6]
        # carouselSer = SkuimageSerializer(initial=carousel, many=True)
        news = TbNews2.objects.order_by('news_time')[1:6]
        new_ser = NewsSerializer(news, many=True)
        return JsonResponse(new_ser.data,  safe=False)



